package com.rushb.user.controller;


import com.rushb.user.pojo.User;
import com.rushb.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Lisir
 * @since 2021-11-02
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @PostMapping("/all")
    public List<User> getAll() {

        for (int i = 0;i<100;i++){
            User user = new User();
            user.setName("韩晓鹏");
            user.setAge("1");
            user.setSex("男");
            userService.save(user);
        }

        return userService.list();
    }

}

